#include <cstdio>
#include <cstdlib>
#include <cstring>

#define CHILDREN_SIZE 10
#define NAME_SIZE 50

using namespace std;

typedef struct Node {
    char name[NAME_SIZE];
    int num;
    struct Node* children[CHILDREN_SIZE];
}Node;

void create(Node* root, char str[]) {
    if (str[0] == '\0') return;
    int i = 0, j;
    char temp_name[NAME_SIZE];
    
    while (str[i] != '\\' && str[i] != '\0') {
        temp_name[i] = str[i];
        ++i;
    }
    temp_name[i] = '\0';
    if (str[i] == '\\') ++i;

    for (j = 0; j < root->num; ++j) {
        if (strcmp(temp_name, root->children[j]->name) == 0) {
            break;  // 找到对应name的节点
        }
    }
    if (j < root->num) {
        root = root->children[j];
    } else {
        Node* n = (Node*)malloc(sizeof(Node));
        strcpy(n->name, temp_name);
        n->num = 0;
        root->children[root->num++] = n;
        root = n;
    }
    create(root, str+i);
}

int cmp(const void *a, const void *b) {
    Node **x = (Node **)a;
    Node **y = (Node **)b;
    return strcmp((*x)->name, (*y)->name);
}

void DFS(Node* root, int add_len) {
    if (add_len >= 0) {
        for (int i = 0; i < add_len; ++i) {
            printf(" ");
        }
        printf("%s\n", root->name);
    }
    qsort(root->children, root->num, sizeof(Node*), cmp);
    for (int i = 0; i < root->num; ++i) {
        DFS(root->children[i], add_len+strlen(root->name)+1);
    }

}

int main() {
    int n;
    char str[NAME_SIZE];
    Node root;

    while (scanf("%d", &n) == 1 && n != 0) {
        root.num = 0;
        root.name[0] = '\0'; // ?

        for (int i = 0; i < n; ++i) {
            scanf("%s", str);
            create(&root, str);
        }

        DFS(&root, -1);
        printf("\n");
    }
    return 0;
}